/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  							 script_victory.h

	$Header: /heroes4/script_victory.h $

	$NoKeywords: $

 ************************************************************************/

// kill the 255+ character identifier warning.  Templates tend to exceed that easily.
#include "precompiled.h"
#pragma warning( disable: 4786 )

#include "script_victory.h"

#include "adventure_frame.h"
#include "adventure_map.h"
#include "adventure_map_window.h"
#include "player.h"

void t_script_win_game::do_action( t_adventure_map* map, t_player* player ) const
{
	t_adventure_map_window* window = map->get_map_window();
	if (window == NULL)
		return;
	t_adventure_frame* frame = map->get_map_window()->get_frame();
	if (frame != NULL) 
	{
		if (same_team( &map->get_player(), player ))
		{
			frame->game_over( k_game_over_result_win, player->get_team() );
		}
		else
		{
			frame->game_over( k_game_over_result_lose, player->get_team() );
		}
	}
}

void t_script_lose_game::do_action( t_adventure_map* map, t_player* player ) const
{
	player->force_elimination();

	t_adventure_map_window* window = map->get_map_window();
	if (window == NULL)
		return;
	t_adventure_frame* frame = map->get_map_window()->get_frame();
	if (frame != NULL)
		frame->evaluate_victory_condition();
}

void t_script_action_disable_std_victory_condition::do_action( t_adventure_map* map, t_player* player ) const
{
	map->set_standard_victory_condition( false );
}

void t_script_action_enable_std_victory_condition::do_action( t_adventure_map* map, t_player* player ) const
{
	map->set_standard_victory_condition( true );
}


